<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>游戏更新</title>
    
    <meta charset="utf-8"/>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" href="gold/css/bootstrap.min.css">
	<script src="gold/js/jquery.js"></script>
	<script src="gold/js/bootstrap.min.js"></script>
	<style type="text/css">
		#container {
			margin-top: -20px;
			margin-left: 10px;
		}
		td {
			vertical-align: middle !important;
		}
	</style>

  </head>
  
  <body>
    <div id="container">
		<div class="page-header ">
			<h2>修改游戏</h2>
		</div>
		<div class="row">
			<div class="col-xs-3 col-sm-7 col-md-offset-2">
				<form class="form-horizontal text-center"
					action="updateGame.do" method="post" enctype="multipart/form-data">
					<table class="table table-bordered table-condensed ">
						<thead></thead>
						<tbody>
							<tr>
								<td >游戏名称</td>
								<td>
									<div class="col-sm-6 col-md-offset-3">
										<input type="text" 
											class="col-sm-12 form-control" value="${gameDetails.gameName}" name="gameName"/>
											
									</div>
								</td>
							</tr>

							<tr>
								<td>游戏类型</td>
								<td>
									<div class="col-sm-6 col-md-offset-3">
										<select class="col-sm-12 form-control " name=gameTypeId>
											<c:forEach items="${gameTypeList}" var="gameType">
												<c:choose>
													<c:when test="${gameType.typeId == gameDetails.gameTypeId}">
														<option selected="selected" value="${gameType.typeId}">${gameType.typeName}</option>
													</c:when>
													<c:otherwise>
														<option value="${gameType.typeId}">${gameType.typeName}</option>
													</c:otherwise>
												</c:choose>
											</c:forEach>
										</select>
									</div>
								</td>
							</tr>

							<tr>
								<td>游戏状态</td>
								<td>
									<div class="col-sm-6 col-md-offset-5">
										<c:forEach items="${gameStatusList}" var="gameStatus">
											<c:choose>
												<c:when test="${gameStatus.id == gameDetails.gameStatusId}">
													<label> <input type="radio" 
														value="${gameStatus.id}" checked="checked" name="gameStatusId"> ${gameStatus.status} </label>
												</c:when>
												<c:otherwise>
													<label> <input type="radio" 
														value="${gameStatus.id}" name="gameStatusId"> ${gameStatus.status} </label>
												</c:otherwise>
											</c:choose>
										</c:forEach>
									</div>
								</td>
							</tr>

							<tr>
								<td>开发商</td>
								<td>
									<div class="col-sm-6 col-md-offset-3">
										<input type="text" class="col-sm-12 form-control"
											value="${gameDetails.gameDevelopers}" name="gameDevelopers"/>
									</div>
								</td>
							</tr>

							<tr>
								<td>备案号</td>
								<td>
									<div class=" col-sm-6 col-md-offset-3">
										<input type="text" class="col-sm-12 form-control"
											value="${gameDetails.gameFiling}" name="gameFiling"/>
									</div></td>
							</tr>

							<tr>
								<td>游戏简介</td>
								<td>
									<div class="col-sm-6 col-md-offset-3">
										<textarea class="form-control"
											rows="3" cols="20" name="gameIntroduction">${gameDetails.gameIntroduction}</textarea>
									</div>
								</td>
							</tr>

							<tr>
								<td>游戏详情</td>
								<td>
									<div class="col-sm-6 col-md-offset-3">
										<textarea class="form-control" 
											rows="3" cols="20" name="gameDetail">${gameDetails.gameDetail}</textarea>
									</div>
								</td>
							</tr>

							<tr>
								<td>游戏币价格</td>
								<td>
									<div class="col-sm-6 col-md-offset-3">
										<input type="text" class="col-sm-12 form-control"
											value="${gameDetails.gameCurrency}" name="gameCurrencyString"/>
									</div>
								</td>
							</tr>

							<tr>
								<td>话费价格</td>
								<td>
									<div class="col-sm-6 col-md-offset-3">
										<input type="text" class="col-sm-12 form-control" 
											value="${gameDetails.gameTariffe}" name="gameTariffeString"/>
									</div>
								</td>
							</tr>

							<tr>
								<td>游戏封面</td>
								<td>
									<div class="col-sm-6  col-md-offset-3">
										<div class="thumbnail">
											<img class="img-responsive img-rounded " width="80"
												src="/file/game/${gameDetails.gameCover}" />
										</div>
										<div class="caption">
											<p>
												<input type="file" name="gameCoverFile"/>
											</p>
										</div>

									</div>
								</td>
							</tr>

							<tr>
								<td>游戏截图</td>
								<td>
									<div class="col-sm-4 col-md-2 col-md-offset-1">
										<div class="thumbnail">
											<img class="img-rounded " width="150"  src="/file/game/screen/${gameScreen1}">
										</div>
										<div class="caption">
											<p><input type="file" name="gameScreen1" /></p>
										</div>
									</div>
									
									<div class="col-sm-4 col-md-2 col-md-offset-1">
										<div class="thumbnail">
											<img class="img-rounded "  width="150"   src="/file/game/screen/${gameScreen2}">
										</div>
										<div class="caption">
											<p><input type="file" name="gameScreen2" /></p>
										</div>
									</div>
									
									<div class="col-sm-4 col-md-2 col-md-offset-1">
										<div class="thumbnail">
											<img class="img-rounded "  width="150"   src="/file/game/screen/${gameScreen3}">
										</div>
										<div class="caption">
											<p><input type="file" name="gameScreen3" /></p>
										</div>
									</div>
								</td>
							</tr>
							<tr>
								<td>创建时间</td>
								<td>
									<div class="col-sm-6 col-md-offset-4">
										${gameDetails.gameCreateTime}
									</div>
								</td>
							</tr>

							<tr>
								<td>修改时间</td>
								<td>
									<div class="col-sm-6 col-md-offset-4">
										${gameDetails.gameUpdateTime}
									</div>
								</td>
							</tr>
						</tbody>
					</table>
					<div class="row">
						<div class="col-xs-6 col-sm-10">
							<div class="form-group">
								<div class="col-xs-6 col-sm-4 col-md-offset-3">
									<input class="btn btn-info" type="submit" value="提交修改" />
								</div>
								<div class="col-xs-6 col-sm-4">
									<button class="btn btn-warning" onclick="goBack()">返回上一页</button>
								</div>
							</div>
						</div>
					</div>
					<input type="hidden" name="gameId" value="${gameDetails.gameId}"/>
				</form>

			</div>
		</div>
	</div>
  </body>
  <script type="text/javascript">
	  	function goBack(){
	  		window.history.back();
	  	}
  </script>
  	
</html>
